package org.example.afiona.feign.impl;

import com.netflix.hystrix.contrib.javanica.annotation.HystrixCommand;
import com.netflix.hystrix.contrib.javanica.annotation.HystrixProperty;
import org.example.afiona.VO.OrderInfoVO;
import org.example.afiona.common.VO.ResultVO;
import org.example.afiona.common.utils.ResultVOUtil;
import org.example.afiona.service.OrderFeignApi;
import org.springframework.web.bind.annotation.RestController;
import springfox.documentation.annotations.ApiIgnore;

import java.math.BigDecimal;
import java.util.List;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @Author: leo
 * @date: 2021/6/9
 */
@RestController
@ApiIgnore
public class OrderFeignImpl implements OrderFeignApi {
    @Override
    public ResultVO<List<OrderInfoVO>> getOrderListByUserId(Integer userId) {
        List<OrderInfoVO> orderInfoVOList = Stream.of(1, 2, 3).map(e -> {
            OrderInfoVO vo = new OrderInfoVO();
            vo.setOrderId(String.valueOf(e));
            vo.setAmount(new BigDecimal(String.valueOf(e * 100)));
            return vo;
        }).collect(Collectors.toList());
        return ResultVOUtil.success(orderInfoVOList);
    }
}
